home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Info / TeachU14 / SAMS / Code / Day08 / btmain.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-08  |  1.9 KB  |  56 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "BTMain.h"
  6. #include "BitBtn.h"
  7. #include "Button.h"
  8. //---------------------------------------------------------------------------
  9.  
  10. #pragma resource "*.dfm"
  11. TMainForm *MainForm;
  12. //---------------------------------------------------------------------------
  13. __fastcall TMainForm::TMainForm(TComponent* Owner)
  14.   : TForm(Owner)
  15. {
  16. }
  17. //---------------------------------------------------------------------------
  18. void __fastcall TMainForm::ShowButtonsClick(TObject *Sender)
  19. {
  20.   int result;
  21.   String text;
  22.   if (Sender == ShowButtons || Sender == BtnsSpeedBtn)
  23.     result = ButtonForm->ShowModal();
  24.   else result = BitBtnForm->ShowModal();
  25.   switch (result) {
  26.     case mrOk     : text = "OK"; break;
  27.     case mrCancel : text = "Cancel"; break;
  28.     case mrAbort  : text = "Abort"; break;
  29.     case mrRetry  : text = "Retry"; break;
  30.     case mrIgnore : text = "Ignore"; break;
  31.     case mrYes    : text = "Yes"; break;
  32.     case mrNo     : text = "No"; break;
  33.     case mrAll    : text = "All"; break;
  34.     default : text = "custom";
  35.   }
  36.   String msgText =
  37.     "Result: You pressed the " + text + " button.";
  38.   Label->Caption = msgText;
  39.   
  40. }
  41. //---------------------------------------------------------------------
  42. void __fastcall TMainForm::AllowAllUpBoxClick(TObject *Sender)
  43. {
  44.   DrawMode->AllowAllUp = AllowAllUpBox->Checked;
  45. }
  46. //---------------------------------------------------------------------
  47. void __fastcall TMainForm::DrawModeClick(TObject *Sender)
  48. {
  49.   String s = "Mode: ";
  50.   TSpeedButton* button = dynamic_cast<TSpeedButton*>(Sender);
  51.   if (button) s += button->Hint;
  52.   if (!DrawMode->Down && !PaintMode->Down && !EraseMode->Down)
  53.     s = "Mode: None";
  54.   ModeLabel->Caption = s;
  55. }
  56. //---------------------------------------------------------------------